package com.lixx.usercenter.services;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lixx.usercenter.model.domain.User;
import com.lixx.usercenter.model.domain.request.UserAddRequest;
import com.lixx.usercenter.model.domain.request.UserQueryRequest;
import com.lixx.usercenter.model.domain.request.UserUpdateRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author KM
* @description 针对表【user(用户表)】的数据库操作Service
* @createDate 2025-07-29 23:53:47
*/
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 检查密码
     * @return long
     * @author Lixx
     * @date 2025/07/30
     */

    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     *
     * @param userAccount  用户帐户
     * @param userPassword 用户密码
     * @return {@link User }
     * @author Lixx
     * @date 2025/07/30
     */

    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request 请求
     * @return int
     * @author Lixx
     * @date 2025/07/30
     */

    int userLogout(HttpServletRequest request);

    /**
     * 插入用户
     *
     * @param userAddRequest 用户添加请求
     * @return {@link Integer }
     * @author Lixx
     * @date 2025/08/05
     */

    Long insertUser(UserAddRequest userAddRequest, HttpServletRequest request);

    /**
     * 删除用户
     *
     * @param id      id
     * @param request 请求
     * @return {@link Integer }
     * @author Lixx
     * @date 2025/08/05
     */

    Integer deleteUser(Long id, HttpServletRequest request);

    /**
     * 更新用户
     *
     * @param userUpdateRequest 用户更新请求
     * @param request           请求
     * @return {@link Integer }
     * @author Lixx
     * @date 2025/08/05
     */

    Integer updateUser(UserUpdateRequest userUpdateRequest, HttpServletRequest request);

    /**
     * 列出用户
     *
     * @param userQueryRequest 用户查询请求
     * @return {@link Page }<{@link User }>
     * @author Lixx
     * @date 2025/08/07
     */

    Page<User> listUser(UserQueryRequest userQueryRequest);

    User getSafeUser(User originUser);

    /**
     * 获取查询包装器
     *
     * @param userQueryRequest 用户查询请求
     * @return {@link QueryWrapper }<{@link User }>
     * @author Lixx
     * @date 2025/08/07
     */

    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);
}
